#ifndef CALCULATING_H
#define CALCULATING_H

#define MAX_NUM_SIZE 30 //maximum number of entered characters and

class galc //Gui cALCculator class
{
private:
    bool numberInputed = false;

    struct inputedNumbers{
        double numbers[MAX_NUM_SIZE]; //array with input numbers
        int thisNum = 0; //current free space in the array of "numbers"

        double number = 0;
        int fractionOn;
        bool positive;
    };

    inputedNumbers inpNums[MAX_NUM_SIZE]; //fuck this
    int thisInputNumber = 0; //current free space in the "inpNums"

    void endNum(){ //end of input number function (backend)
        for(int i = 0; i <= inpNums[thisInputNumber].thisNum; i++){
            inpNums[thisInputNumber].number += inpNums[ thisInputNumber ].numbers[i] + (10 * i); //enter algoritm :D
        }
        thisInputNumber++;
    }

public:
    /*
     * if the entered number in "addNumber" function does not exceed the size of the array,
     * then it returns "true", otherwise "false"
    */
    bool addNumber(double input){
        if(!numberInputed && thisInputNumber != MAX_NUM_SIZE){
            if(inpNums[thisInputNumber].thisNum < MAX_NUM_SIZE){
                inpNums[thisInputNumber].numbers[inpNums[thisInputNumber].thisNum] = input;
                inpNums[thisInputNumber].thisNum++;
                return true;
            } else {
                return false;
            }
        } else {
            return false;
        }
    }

    bool endOfNumber(){ //function that completes the input of the current number
        if(!numberInputed){
            numberInputed = true;
            endNum();
            return true;
        } else {
            return false;
        }
    }
};

#endif // CALCULATING_H
